<template>
  <view class="loading" v-if="showMask">
    <view class="loading_top">
      <u-loading-icon size="36" :show="showMask"></u-loading-icon>
    </view>
  </view>
</template>
<script lang="ts" setup>
/**
 *  全局loading 配合 headTop组件使用
 */
import { componentsStore } from '@/store/modules/components'
import { ref, watch, computed } from 'vue'
const store = componentsStore()
const showMask = ref<boolean>(false)
store.$subscribe((i, Node) => {
  if (Node.loading_) {
    showMask.value = Node.loading_
  } else {
    setTimeout(() => {
      showMask.value = Node.loading_
    }, 200)
  }
})
</script>
<style lang="scss" scoped>
@import "./index.scss";
</style>